package com.vurenium.ras.security;

import java.io.Serializable;
import javax.servlet.jsp.jstl.sql.Result;
import com.vurenium.ras.util.*;
/**
 * Login backing bean - implements login validation 
 */
public class Login implements Serializable {

	private static final long serialVersionUID = 1L;
	
	private String loginName;
	private String password;
	
	public String getLoginName() {
		return loginName;
	}
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String authenticate() {
		String returnValue = "fail";
		try {
		Result r = (Result)(DBHelper.select("select * from rastest" )).getWrappedData();
		if (r.getRowCount()>0){
			setPassword(r.getRowsByIndex()[0][0].toString());
			returnValue = "success";
		}
		}catch (Exception e){
			returnValue= "fail";
		}
		return returnValue;
		
	}
	

}
